/**
 * @author: 團長
 * @date: 2013-5-14-下午3:30:58
 */
package net.loyintean.pearlshell.basedb.dto;

import java.io.Serializable;
import java.util.Date;

/**
 * 数据库交互的基类
 * <p>
 * Loy: deprecated {@link #id} and it's accessers, add {@link #primaryKey}
 * instead. v2014-8-26.1.1.0
 * <p>
 * Loy: set the default value of {@link #primeKey} as "-1", to fix a bug of
 * {@link #getId()}. v20140828.1.1.1
 * <p>
 * Loy: add field of {@link #pager} and {@link #operator}. v20140910.2.0.0
 * 
 * @author 團長
 * @version v20140910.2.0.0
 */
public class BaseDto implements Serializable {

	/**
	 * 
	 * @author 團長
	 * @since 2013-5-14
	 */
	private static final long serialVersionUID = 8627843713366823805L;

	/**
	 * the new primary key.
	 * <p>
	 * 新的主键定义。
	 * 
	 */
	private String primeKey = "-1";

	/**
	 * 序列号
	 * 
	 * @author 團長
	 * @since 2013-5-14
	 */
	private Long serialNo;

	/**
	 * 标志位。建议只做有效标志位使用；不做状态标志位。
	 * 
	 * @author 團長
	 * @since 2013-5-14
	 */
	private String flag;

	/**
	 * 备注字段
	 * 
	 * @author 團長
	 * @since 2013-5-20
	 */
	private String remark;

	/**
	 * infomation about db operator.
	 * 
	 */
	private Operator operator = new Operator();

	/**
	 * infomation for page.
	 * 
	 */
	private Pager pager = new Pager();

	/**
	 * @return the {@link #operator#getCreateTime()}
	 */
	public Date getCreateTime() {
		return this.operator.getCreateTime();
	}

	/**
	 * @param createTime
	 *            set to {@link #operator#setCreateTime(Date)}
	 */
	public void setCreateTime(Date createTime) {
		this.operator.setCreateTime(createTime);
	}

	/**
	 * @return the {@link #operator#getCreater()}
	 */
	public String getCreater() {
		return this.operator.getCreater();
	}

	/**
	 * @param creater
	 *            set to {@link #operator#setCreater(String)}
	 */
	public void setCreater(String creater) {
		this.operator.setCreater(creater);
	}

	/**
	 * @return the {@link #operator#getUpdateTime()}
	 */
	public Date getUpdateTime() {
		return this.operator.getUpdateTime();
	}

	/**
	 * @param updateTime
	 *            set to {@link #operator#setUpdateTime(Date)}
	 */
	public void setUpdateTime(Date updateTime) {
		this.operator.setUpdateTime(updateTime);
	}

	/**
	 * @return the {@link #operator#getUpdater()}
	 */
	public String getUpdater() {
		return this.operator.getUpdater();
	}

	/**
	 * @param updater
	 *            set to {@link #operator#setUpdater(String)}
	 */
	public void setUpdater(String updater) {
		this.operator.setUpdater(updater);
	}

	/**
	 * @return the {@link #flag }
	 */
	public String getFlag() {
		return flag;
	}

	/**
	 * @param flag
	 *            the {@link #flag }to set
	 */
	public void setFlag(String flag) {
		this.flag = flag;
	}

	/**
	 * @return the {@link #serialNo }
	 */
	public Long getSerialNo() {
		return serialNo;
	}

	/**
	 * @param serialNo
	 *            the {@link #serialNo }to set
	 */
	public void setSerialNo(Long serialNo) {
		this.serialNo = serialNo;
	}

	/**
	 * @return the {@link #remark }
	 */
	public String getRemark() {
		return remark;
	}

	/**
	 * @param remark
	 *            the {@link #remark }to set
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * @return the {@link #primeKey }
	 */
	public String getPrimeKey() {
		return primeKey;
	}

	/**
	 * @param primeKey
	 *            the {@link #primeKey }to set
	 */
	public void setPrimeKey(String primeKey) {
		this.primeKey = primeKey;
	}

	/**
	 * 
	 * @return {@link #pager#getPageNum()}
	 */
	public Integer getPageNum() {
		return this.pager.getPageNum();
	}

	/**
	 * 
	 * @param pageNum
	 *            set to {@link #pager#setPageNum(Integer)}
	 */
	public void setPageNum(Integer pageNum) {
		this.pager.setPageNum(pageNum);
	}

	/**
	 * 
	 * @return {@link #pager#getPageSize()}
	 */
	public Integer getPageSize() {
		return this.pager.getPageSize();
	}

	/**
	 * 
	 * @param pageSize
	 *            set to {@link #pager#setPageSize(Integer)}
	 */
	public void setPageSize(Integer pageSize) {
		this.pager.setPageSize(pageSize);
	}

	/**
	 * 
	 * @return {@link #pager#getStartIndex()}
	 */
	public Integer getStartIndex() {
		return this.pager.getStartIndex();
	}

	/**
	 * 
	 * @param startIndex
	 *            set to {@link #pager#setStartIndex(Integer)}
	 */
	public void setStartIndex(Integer startIndex) {
		this.pager.setStartIndex(startIndex);
	}

	/**
	 * 
	 * @return {@link #pager#getEndIndex()}
	 */
	public Integer getEndIndex() {
		return this.pager.getEndIndex();
	}

	/**
	 * 
	 * @param endIndex
	 *            set to {@link #pager#setEndIndex(Integer)}
	 */
	public void setEndIndex(Integer endIndex) {
		this.pager.setEndIndex(endIndex);
	}

	/**
	 * 
	 * @author Loy-winters1224@163.com
	 * @see java.lang.Object#toString()
	 * 
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("BaseDto [");
		if (primeKey != null) {
			builder.append("primeKey=");
			builder.append(primeKey);
			builder.append(", ");
		}
		if (serialNo != null) {
			builder.append("serialNo=");
			builder.append(serialNo);
			builder.append(", ");
		}
		if (flag != null) {
			builder.append("flag=");
			builder.append(flag);
			builder.append(", ");
		}
		if (remark != null) {
			builder.append("remark=");
			builder.append(remark);
			builder.append(", ");
		}
		if (operator != null) {
			builder.append("operator=");
			builder.append(operator);
			builder.append(", ");
		}
		if (pager != null) {
			builder.append("pager=");
			builder.append(pager);
		}
		builder.append("]");
		return builder.toString();
	}

}
